<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <div class="list">
      <div class="list-content">
        <div
          @contextmenu.stop="emit('onContextMenuChild', $event, index)"
          v-for="(item, index) in props.info.showpieceList"
          :key="index"
          class="exhibits-item"
          :class="'exhibits-item-' + index"
        >
          <div class="list-content-top">
            <div
              @click="viewImg(item.moduleId, item.id)"
              class="item-content"
              :style="{
                backgroundImage: `url(${publicUrls + 'free/style14/displayBoardBg2Top.webp'})`,
              }"
            >
              <div class="cover-box">
                <img class="cover" v-lazy="getLinkUrl(item.coverUrl, '?imageView2/3/w/600/format/webp')" alt="" />
                <img
                  v-if="route.meta.loopType"
                  class="flower-btn"
                  v-lazy="publicUrls + 'free/style2/flower.webp'"
                />
              </div>
            </div>
            <div
              class="items-title"
              :style="{
                backgroundImage: `url(${publicUrls + 'free/style14/exhibitsStyle2Bg.webp'})`,
              }"
            >
              <div class="title-content">
                {{ item.name }}
              </div>
            </div>
          </div>
          <div
            class="list-content-bottom"
            :style="{
              backgroundImage: `url(${publicUrls + 'free/style14/displayBoardBg2Bottom.webp'})`,
            }"
          ></div>
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
  name: 'free14Style2',
});
</script>
<script lang="ts" setup>
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { getLinkUrl } from '@/utils/request/upload';
import { useRoute } from 'vue-router';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const route = useRoute();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
// watch(
//   () => props.info.width,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );
// watch(
//   () => props.info.height,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );

//
</script>

<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  z-index: 999;
  padding: 0 !important;
  -webkit-box-reflect: below 30% linear-gradient(transparent, rgba(0, 0, 0, 0.3));
}
.list {
  display: flex;
  padding: 0 20px;
  width: 100%;
  height: 100%;
}
.list-content {
  display: flex;
  height: 100%;
}
.exhibits-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-right: 40px;
}
.exhibits-item:nth-child(2n) {
  margin-top: 100px;
}
.list-content-top {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.item-content {
  flex-shrink: 0;
  position: relative;
  width: 306px;
  height: 379px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.cover-box {
  width: 275px;
  height: 314px;
  position: absolute;
  left: 8px;
  top: 48px;
  overflow: hidden;
}
.cover {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: all 0.5s;
}
.exhibits-item:hover {
  .cover {
    transform: scale(1.2);
  }
}
.flower-btn {
  width: 50px;
  height: 50px;
  object-fit: cover;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: flower 2s linear infinite;
  @keyframes flower {
    0% {
      opacity: 0;
    }
    40% {
      opacity: 100%;
    }
    60% {
      opacity: 100%;
    }
    100% {
      opacity: 0;
    }
  }
}
.items-title {
  flex-shrink: 0;
  width: 232px;
  height: 40px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.title-content {
  width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #20b3ba;
  text-align: center;
  text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.25);
  -webkit-text-stroke-width: 0.3px;
  -webkit-text-stroke-color: #d4bb8f;
  font-family: 'SourceHanSerifCN';
  font-size: 18px;
  font-style: normal;
  font-weight: 400;
  line-height: 180%; /* 32.4px */
}
.list-content-bottom {
  flex-shrink: 0;
  width: 300px;
  height: 170px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  margin-top: 60px;
}
</style>
